/*
 * <p>Title:       简单的标题</p>
 * <p>Description: 稍详细的说明</p>
 * <p>Copyright:   Copyright (c) 2004</p>
 * <p>Company:     东软集团股份有限公司</p>
 */
package com.ll.core.httpbase;

import com.ll.core.model.ResponseEnvelope;
import com.ll.core.util.JSONTool;
import com.ll.core.util.TypeTokens;

public class HttpResponse {
	public HttpResponse(int code, String errorMessage, String context) {
		super();
		this.code = code;
		this.errorMessage = errorMessage;
		this.context = context;
	}

	public HttpResponse() {
		super();
	}

	private int code;
	private String errorMessage;
	private String context;

	public int getCode() {
		return code;
	}

	public void setCode(int code) {
		this.code = code;
	}

	public String getErrorMessage() {
		return errorMessage;
	}

	public void setErrorMessage(String errorMessage) {
		this.errorMessage = errorMessage;
	}

	public String getContext() {
		return context;
	}

	public void setContext(String context) {
		this.context = context;
	}

	public ResponseEnvelope<String, String> getResponse() {
		ResponseEnvelope<String, String> rps = null;
		if (this.context != null) {
			rps = (ResponseEnvelope<String, String>) JSONTool.stringToObject(
					this.context, TypeTokens.TYPETOKEN_RESPONSEENVELOPE);
		}
		return rps;
	}

}
